package com.hxzy.tms.service;

import java.util.Date;
import java.util.List;
import java.util.Set;

import com.hxzy.tms.entity.Project;
import com.hxzy.tms.entity.Team;
import com.hxzy.tms.entity.TeamUser;
import com.hxzy.tms.entity.User;

public interface TeamService {
    ServiceResult<Team> read(long id);

    ServiceResult<Team> read(String domain);

    ServiceResult<Team> update(long id, String name, String desc, String intro, String subdomain, Date gmtBegin,
            Date gmtEnd, Integer status);

    ServiceResult<Team> create(String name, String desc, String intro, String subdomain, Date gmtBegin, Date gmtEnd,
            Integer status);

    ServiceResult<List<User>> members(long teamId);

    ServiceResult<Set<Project>> projects(long teamId);

    List<Team> list(Integer status);

    // 用户创建的团队
    ServiceResult<List<Team>> userCreateTeams(long userId, Integer status);
    
    // 我加入的团队列表
    ServiceResult<List<TeamUser>> userJoinedTeams(long userId);

    /**
     * 邀请指定的用户到指定的团队
     * 
     * @param uid
     *            邀请人
     * @param teamId
     *            团队id
     * @param email
     *            被邀请人的邮箱
     * @return 1：加入成功， -1：email 对应的用户不存在 -2: 用户已经加入了该团队
     */
    int invite(long uid, long teamId, String email);

    /**
     * 创建项目
     * 
     * @param title
     * @param desc
     * @return
     */
    ServiceResult<Project> create(long teamId, String title, String desc);

    /**
     * 修改项目
     * 
     * @param projectId
     * @param title
     * @param desc
     * @param taskCount
     * @return
     */
    ServiceResult<Project> update(long projectId, long teamId, String title, String desc, int taskCount);

    ServiceResult<Project> readProject(long projectId);

}
